/**
 * 角色模块
 */

const express = require('express');
const { ROLE_TYPE, networkStatus } = require('../utils/constant');
const router = express.Router();

// 查询角色
router.get('/search', async (req, res) => {
    try {
        const roles = ROLE_TYPE;
        // 处理对象成数组
        res.send({
            code: 200,
            data: Object.keys(roles).map(key => {
                return {
                    label: key,
                    value: roles[key]
                }
            }),
            msg: networkStatus['200'],
        })
    } catch (error) {
        res.send({
            code: 500,
            data: error,
            msg: networkStatus['500'],
        })
    }
})

module.exports = router;
